package com;

import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class TestSelect3 {
    public static void main(String[] args) {
        MyBatisSqlSessionFactory factory = new MyBatisSqlSessionFactory();
        SqlSession sqlSession = factory.getMyBatisSqlSessionFactory().openSession();
        TestDao3 testDao3 = sqlSession.getMapper(TestDao3.class);
        System.out.println(testDao3);

// <!--    嵌套 Select 语句实现一对多映射 查询 -->
        Address address = testDao3.findAddressById(2);//通过地址id获取地址表的信息
        List<Course> courseList = testDao3.findCoursesById(2);//通过老师的id获取课程数的多条信息
        Tutor tutor = testDao3.findTutorById(2);//获取老师表的信息，老师表里有地址和课程
        System.out.println(address);
        System.out.println(courseList);
        System.out.println(tutor);

    }
}
